# 封装
class Person:
    nums = 0
    def __init__(self,name,age,city):
        self._name = name  # 封装，受保护的属性
        self.__age = age  # 封装，私有属性
        self.city = city
        Person.nums += 1
    # 获取到对象属性值的方法
    @property
    def age(self):
        return self.__age
    # 设置对象属性值的方法
    @age.setter
    def age(self,age):
        self.__age = age
p1 = Person("张三",20,"上海")
print(p1._name)
print(p1.__dict__)
print(p1.age)
p1.age = 21
print(p1.age)
print(p1.city)